package library.entity;

import com.j256.ormlite.field.DataType;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

@DatabaseTable(tableName = "book")
public class Book{
	@DatabaseField(generatedId = true)
	private int id;
	@DatabaseField(canBeNull = false, indexName = "book_name_index")
	private String name;
	@DatabaseField
	private long isbn;
	@DatabaseField(dataType = DataType.ENUM_STRING)
	private BookStatus status;
	
	public Book(){
		
	}
	
	public Book(String newBookName, long ISBN){
		name = newBookName;
		status = BookStatus.Available;
		isbn = ISBN;
	}
	
	public int getId(){
		return id;
	}
	
	public String getName(){
		return name;
	}
	
	public void setStatus(BookStatus bookStatus) {
		status = bookStatus;
	}

	public BookStatus getStatus() {
		return status;
	}

	
	public String toString(){
		return String.format("Book id: %s, Name: %s, Book status: %s\n", id, name, status.toString());
	}
}
